
<?php if(!empty($clientes)):?>

<div class="widget">
            <table cellpadding="0" cellspacing="0" width="100%" class="tDark">
                <thead>
                    <tr>
                        <td>Nro</td>
                        <td>Nombre</td>
                        <td>Telefono</td>
                        <td>Celular</td>
                        <td>NIT</td>
                    </tr>
                </thead>
                <tbody>
                    <?php  $i = 0;  ?>
                <?php foreach ($clientes as $cli):$i++;  ?>
                
                <tr id="redirec<?php echo $cli['Cliente']['id'];?>">
                    <td><?php echo $i; ?></td>
                    <td><?php echo $cli['Cliente']['nombre']; ?></td>
                    <td><?php echo $cli['Cliente']['telefono']; ?></td>
                    <td><?php echo $cli['Cliente']['celular']; ?></td>
                    <td ><?php echo $cli['Cliente']['nit']; ?></td>
                </tr>
                
                <?php 
                
                                            $this->Js->get('#redirec'.$cli['Cliente']['id'])->event(
                                            'click',
                                            'window.location.assign("'.$this->Html->url(array('controller'=>'Ventasproductos','action' => 'index',$cli['Cliente']['id'],$idventa), true).'")'
                                            );

                                            ?>
            <?php endforeach; ?>
            
                </tbody>
            </table>
        
        </div>
        

<?php else:?>
<div class="formRow">
    <?php
    echo $this->Form->create('Cliente', array('action' => 'guardacliente/'.$idventa));
   ?>
        <div class="grid3"><label>Cliente:<span class="req">*</span></label></div>
        <div class="grid3">
            <?php echo $this->Form->text('nombre', array('class'=>'validate[required] input-text', 'size'=>'40', 'id'=>'validate')); ?>
        </div>
        <div class="grid3"><label>Telefono:<span class="req">*</span></label></div>
        <div class="grid3">
            <?php echo $this->Form->text('telefono', array('class'=>'validate[required] input-text', 'size'=>'40', 'id'=>'validate')); ?>
        </div>
        <div class="grid3"><label>Celular:<span class="req">*</span></label></div>
        <div class="grid3">
            <?php echo $this->Form->text('celular', array('class'=>'validate[required] input-text', 'size'=>'40', 'id'=>'validate')); ?>
        </div>
        <div class="grid3"><label>Nit:<span class="req">*</span></label></div>
        <div class="grid3">
            <?php echo $this->Form->text('nit', array('class'=>'validate[required] input-text', 'size'=>'40', 'id'=>'validate')); ?>
        </div>

        <div class="grid3">
        <?php
        echo $this->Form->submit('Guardar',array('class' => 'buttonS bGreen'));
        echo $this->Form->end();
        ?>
        </div>
        
        
        <div class="clear"></div>
    </div>
<?php endif;?>
<?php echo $this->Js->writeBuffer(); ?>